/**
 * FileFind - ftp/shares indexing and search php engine
 * Module: persist-jpa20
 * Description: Persistence implementation with JPA 2.0
 * Copyright (c) 2003-2010 Rage Steel, www.gt2.ru
 */
package ru.ffind.persist.jpa20.bean;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 * Holder for EntityManagerFactory
 *
 * @author Rage Steel
 */
public abstract class AbstractEntityManagerFactoryBean {
    private static final String PERSISTENCE_UNIT_NAME = "filefind";
    
	private final EntityManagerFactory entityManagerFactory =
            Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);

    /**
     * Return EntityManagerFactory.
     *
     * @return
     */
    public EntityManagerFactory getEntityManagerFactory() {
        return entityManagerFactory;
    }

    /**
     * Creates a new EntityManager.
     * 
     * @return
     */
    public EntityManager createEntityManager() {
        return entityManagerFactory.createEntityManager();
    }

}
